package banking;

/**
 * 创建一个简单的银行程序包
 * @author xbd
 * @create 2021-06-03 7:54
 */
public class Account {
    protected double balance;

    public Account(double init_balance) {
        this.balance = init_balance;
    }

    public double getBalance() {
        return balance;
    }

    public boolean deposit(double amt){
        if(amt > 0){
            balance += amt;
            return true;
        }
        return false;
    }

    public boolean withdraw(double amt){
        if(balance > amt){
            balance -= amt;
            return true;
        }else{
            System.out.println("余额不足");
            return false;
        }
    }
}
